<template>
  <view class="shorthand-container">
    <view class="nav-container" v-if="topBar.style ==='custom'">
      <view class="status-contents" :style="{marginTop: topBar.statusBarHeight+'px'}">
        <view @click="toBack" class="back_wrap">
          <image src="../../static/black_back.png" mode="widthFix" class="back"></image>
        </view>
      </view>
    </view>
    <view class="bg">
      <view class="text_body">
        <view class="text">做密卷</view>
        <view class="text">放心过考！</view>
      </view>
    </view>
    <view class="shorthand-item-list">
      <view class="shorthand-item" v-for="(item,i) in list" :key="i" @click="itemAction(item)">
        <text class="city">Vol.{{ i + 1 }}</text>
        <text class="title">{{ item.title }}</text>
        <view class="left"></view>
        <view class="num">{{ i + 1 }}</view>
      </view>
    </view>
    <view class="tips-container">
      <view class="tips-title">温馨提示</view>
      <view class="tips-row">1、密卷涵盖了几乎所有的常考知识点，建议考前做完所有密卷题。</view>
      <view class="tips-row">2、建议密卷与精选500题一起练习，同时巩固复习错题本。</view>
    </view>
  </view>
</template>

<script>
import navbar from "../../components/navbar";
import {questionApi} from "../../api";
import {mapGetters} from 'vuex'

export default {
  components: {navbar},
  data() {
    return {
      kemu: null,
      list: []
    }
  },
  computed: {
    ...mapGetters(['topBar']),
  },
  async onLoad({kemu}) {
    this.kemu = kemu
    const res = await questionApi.mijuanList(kemu)
    this.list = res.data.data.list
  },
  methods: {
    itemAction(item) {
      uni.navigateTo({
        url: `/pages/detail/detail?from=mijuan&type=category_${item.id}&title=${item.title}&kemu=` + this.kemu
      })
    },
    toKaochang(item) {
      uni.navigateTo({
        url: `/pages/kaochang_moni/kaochang_moni?type=category_${item.id}&kemu=` + this.kemu + `&title=${item.title}`
      })
    },
    toBack() {
      uni.navigateBack()
    }
  }
}
</script>

<style lang="scss">
.shorthand-container {
  display: flex;
  flex-direction: column;

  .nav-container {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 10;
    color: rgba(240, 173, 78, 0);

    .status-contents {
      height: 44px;
      box-sizing: border-box;
      padding: 20rpx 30rpx;
      display: flex;
      color: #fff;
      margin-top: var(--status-bar-height);

      .back_wrap {
        align-self: center;
        background-color: rgba(236, 235, 235, 0.8);
        width: 70rpx;
        height: 70rpx;
        border-radius: 100rpx;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      .back {
        width: 36rpx;
        height: 36rpx;
      }

      .title {
        align-self: center;
        margin: 0 auto;
        font-size: 32rpx;
        font-weight: 500;
      }
    }
  }

  .bg {
    width: 750rpx;
    height: 502rpx;
    background-image: url("@/static/mijuan_bg.png");
    background-size: 100% auto;
    background-position: bottom;
    background-repeat: no-repeat;
    position: relative;
    font-size: 55rpx;
    color: rgba(220, 56, 48, 1);
    font-weight: bold;

    .text_body {
      position: absolute;
      bottom: 150rpx;
      left: 50rpx;
      display: flex;
      flex-direction: column;
      justify-content: center;
      .text {

      }
    }
  }

  .shorthand-item-list {
    background-color: #f8f8f8;
    margin-top: -35rpx;
    border-top-left-radius: 36rpx;
    border-top-right-radius: 36rpx;
    padding-top: 30rpx;
    display: flex;
    flex-wrap: wrap;
    padding-left: 10rpx;
    z-index: 1;

    .shorthand-item {
      margin-left: 22rpx;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      width: 333rpx;
      height: 414upx;
      margin-bottom: 24rpx;
      border-radius: 32rpx;
      background: linear-gradient(180deg, #f89c65 0%, #ffbd95 100%);
      color: #fff;
      padding-top: 56rpx;
      padding-left: 52rpx;
      position: relative;
      overflow: hidden;

      .num {
        font-size: 180rpx;
        font-weight: bold;
        color: rgba(255, 255, 255, 0.4);
        position: absolute;
        right: 50rpx;
        bottom: -50rpx;
      }

      .left {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 40rpx;
        background-color: rgba(0, 0, 0, 0.05);
      }

      .location {
        width: 32upx;
        height: 40upx;
      }

      .city {
        font-size: 56rpx;
        font-weight: bold;
      }

      .title {
        font-weight: bold;
        font-size: 30upx;
        margin-top: 16rpx;
      }

      .desc {
        font-size: 28upx;
      }
    }
  }


  .btn {
    color: #fff;
    font-size: 16px;
    height: 65rpx;
    width: 180rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 35rpx;
    border-radius: 50px;
    background-image: linear-gradient(to right, rgb(22, 106, 245), rgb(43, 155, 250));
  }

  .shorthand-icon {
    width: 68upx;
    height: 68upx;
    margin-left: 28upx;
  }

  .shorthand-title {
    color: #000000;
    font-size: 18px;
    margin-left: 35upx;
    font-weight: bold;
    flex: 1;
  }

  .shorthand-sub-title {
    color: #A0A0A0;
    font-size: 12px;
    margin-top: 8rpx;
    margin-left: 30upx;
  }

  .shorthand-arrow {
    width: 8upx;
    height: 16upx;
    margin-right: 34upx;
  }

  .tips-container {
    padding: 55rpx 32rpx;
  }

  .tips-title {
    color: #EC4E36;
    font-weight: bold;
    font-size: 17px;
  }

  .tips-row {
    font-size: 14px;
    color: #1A1E27;
    line-height: 23px;
    margin-top: 20rpx;
  }
}

</style>
